<?php
namespace Home\Model;
use Think\Model;
class UserModel extends Model {
	//注册时检测邮箱是否存在
    public function checkEmail($email){
    	//$res = $this->where("email='{$email}'")->find();	  
        $sql = "select * from user where email='{$email}'";

        $res = $this->query($sql);

        return $res;
    }

    //注册时检测用户昵称是否存在
    public function checkNickname($nickname){
              
        $sql = "select * from user where nickname='{$nickname}'";

        $res = $this->query($sql);

        return $res;
    }

    //登陆时检测邮箱和密码是否正确
    public function checkLogin($email,$password){
        
        $password = md5($password);

        $sql = "select * from user where email='{$email}' and password='{$password}'";

        $res = $this->query($sql);

        return $res;
    }


    
}